import request from '@/utils/request'

// 注册
export function register (data) {
  return request({
    method: 'POST',
    url: '/admin/regist',
    data
  })
}

// 登录
export function login (data) {
  return request({
    method: 'POST',
    url: '/admin/login',
    data
  })
}

// 视频列表
export function getVideoList (page) {
  return request({
    method: 'GET',
    url: '/admin/getvideolist?page=' + page
  })
}

// 用户列表
export function getUserList (page) {
  return request({
    method: 'GET',
    url: '/admin/getuserlist?page=' + page
  })
}

// 删除视频
export function removeVideo (data) {
  return request({
    method: 'DELETE',
    url: '/admin/removevideo',
    data
  })
}

// 删除用户
export function removeUser (data) {
  return request({
    method: 'DELETE',
    url: '/admin/removeuser',
    data
  })
}

// 获取视频搜索列表
export function getVideoSearch (key, page) {
  return request({
    method: 'GET',
    url: `/video/getvideosearch/${key}?page=` + page
  })
}

// 获取用户搜索列表
export function getUserSearch (key, page) {
  return request({
    method: 'GET',
    url: `/users/getusersearch/${key}?page=` + page
  })
}

// 获取用户搜索列表
export function getVideoLabel () {
  return request({
    method: 'GET',
    url: '/video/getvideolabel'
  })
}

// 添加视频标签
export function addVideoLabel (data) {
  return request({
    method: 'POST',
    url: '/admin/addvideolabel',
    data
  })
}

// 删除视频标签
export function removeVideoLabel (data) {
  return request({
    method: 'DELETE',
    url: '/admin/removevideolabel',
    data
  })
}

// 根据用户地区进行统计
export function groupbyUserLocation () {
  return request({
    method: 'GET',
    url: '/admin/groupbyuserlocation'
  })
}

// 根据用户性别进行统计
export function groupByGender () {
  return request({
    method: 'GET',
    url: '/admin/groupbygender'
  })
}

// 根据视频地区进行统计
export function groupbyVideoLocation () {
  return request({
    method: 'GET',
    url: '/admin/groupbyvideolocation'
  })
}

// 根据视频风格类型进行统计
export function groupByVideoLabel () {
  return request({
    method: 'GET',
    url: '/admin/groupbyvideolabel'
  })
}

// 根据视频发布时间进行统计
export function groupByPublicTime () {
  return request({
    method: 'GET',
    url: '/admin/groupbypublictime'
  })
}

// 根据用户id进行排序
export function rankByUserId (page) {
  return request({
    method: 'GET',
    url: '/admin/rankbyuserid?page=' + page
  })
}

// 根据用户名字进行排序
export function rankByName (page) {
  return request({
    method: 'GET',
    url: '/admin/rankbyname?page=' + page
  })
}

// 根据喜欢人数进行排序
export function getVideoRankByLikeNum (page) {
  return request({
    method: 'GET',
    url: '/admin/getvideorankbylikenum?page=' + page
  })
}
